<template>
  <h2>我是About的内容</h2>
</template>

<script>
export default {
  name: "About",
  // mounted() {
  //   // console.log("About组件挂在完毕了", this);
  // },
  // beforeDestroy() {
  //   console.log("About即将被销毁");
  // },
  beforeRouteEnter(to, from, next) {
    console.log("组件内路由守卫--beforeRouteEnter", to.name, from.name);
    if (to.meta.isAuth) {
      //判断是否需要鉴权
      if (localStorage.school === "黑马") {
        next();
      } else {
        alert("学校名字不对");
      }
    } else {
      next();
    }
  },
  beforeRouteLeave(to, from, next) {
    console.log("组件内路由守卫--beforeRouteLeave", to.name, from.name);
    next();
  },
};
</script>

<style></style>
